#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Widget;

class BadPredicate
{
public:
    BadPredicate()
        :timesCalled(0)
    {}

    //err 需要是纯函数,返回值只与参数有关。
    bool operator() (const Widget &)
    {
        return ++timesCalled == 3;
    }
private:
    size_t timesCalled;
};

void test()
{
    vector<Widget> vw;
    vw.erase(remove_if(vw.begin(), vw.end(), BadPredicate()), vw.end());
}

int main(int argc, char *argv[])
{
    return 0;
}
